package com.cloudfast.platform.user.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.cloudfast.dao.BaseDao;
import com.cloudfast.dao.impl.BaseDaoImpl;
import com.cloudfast.platform.user.entity.User;

/**
 * @author liuyw
 * @描述:用户
 * @date 2020年4月10日
 */
public interface UserDao extends BaseCustomer, JpaRepository<User, Long> {

    /**
     * 根据用户名称查询
     *
     * @param username
     * @return
     */
    @Query("from User where username=?1")
    public User findByUserName(String username);

    /**
     * 修改密码
     *
     * @param id
     * @param password
     */
    @Modifying
    @Query("update User set password=?2 where id=?1")
    public void updateUserPassword(Long id, String password);

}

interface BaseCustomer extends BaseDao<User, Long> {

}

@Repository
class UserDaoImpl extends BaseDaoImpl<User, Long> implements BaseCustomer {

}
